// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   AdminLoginAction.java

package com.market.web.action;

import org.apache.struts.action.ActionMessages;

import com.market.web.XMLLoader;

// Referenced classes of package com.market.web.action:
//            BaseAction

public class AdminLoginAction extends BaseAction2
{

    private String id;

    private String pass;

    private String path = "";

    public String getId()
    {
        return id;
    }

    public void setId(String id)
    {
        this.id = id;
    }

    public String getPass()
    {
        return pass;
    }

    public void setPass(String pass)
    {
        this.pass = pass;
    }

    public String getPath()
    {
        return path;
    }

    public void setPath(String path)
    {
        this.path = path;
    }
    
    public AdminLoginAction()
    {
    }

    public String execute()
        throws Exception
    {
        //LoginForm lf = (LoginForm)form;
        Integer er = (Integer)getRequest().getSession().getAttribute("error");
        int err = 0;
        ActionMessages error = new ActionMessages();
        if(er != null)
        {
            err = er.intValue();
        }
        /*if(err >= 3)
        {
            error.add("org.apache.struts.action.GLOBAL_MESSAGE", new ActionMessage("\u60A8\u9519\u8BEF\u767B\u5F55\u5DF2\u7ECF\u8D85\u8FC7\u4E09\u6B21!", false));
            saveErrors(request, error);
            return mapping.getInputForward();
        }*/
        /*String adminName = EncryptData.decrypt(XMLLoader.getAdminName());
        String adminPass = EncryptData.decrypt(XMLLoader.getAdminPass());*/
        
        String adminName = XMLLoader.getAdminName();
        String adminPass = XMLLoader.getAdminPass();
        
        if(logger.isDebugEnabled())
        {
            logger.debug("lf.getId() is {}",getId());
            logger.debug("lf.getPass() is {}",getPass());
            logger.debug("adminName is {}",adminName);
            logger.debug("adminPass is {}",adminPass);
        }
        
        
        if(adminName.equals(getId()) && adminPass.equals(getPass()))
        {
            getRequest().getSession().setAttribute("admin", "true");
            return SUCCESS;
            //return mapping.findForward("admin");
        } else
        {
            getRequest().getSession().setAttribute("error", new Integer(++err));
            /*error.add("org.apache.struts.action.GLOBAL_MESSAGE", new ActionMessage("\u5BC6\u7801\u6216\u7528\u6237\u540D\u9519\u8BEF!!", false));
            saveErrors(request, error);*/
            return INPUT;
            //return mapping.getInputForward();
        }
    }
}
